import request from '@/utils/request'

function queryAll () {
  return request({
    url: '/category/all',
    method: 'get'
  });
}

function categoryList (param) {
  return request({
    url: '/category/list',
    method: 'get',
    params: param
  });
}

function addCategory (data) {
  return request({
    url: '/category/add',
    method: 'post',
    data
  });
}

function editCategory (data) {
  return request({
    url: '/category/update',
    method: 'post',
    data
  });
}

function delCategory (id) {
  return request({
    url: '/category/delete',
    method: 'get',
    params: {
      id: id
    }
  });
}

function getById (id) {
  return request({
    url: '/category/detail',
    method: 'get',
    params: {
      id: id
    }
  });
}

export {
  queryAll,
  categoryList,
  addCategory,
  editCategory,
  delCategory,
  getById
}
